package com.zgs.mall.search.controller;

import com.zgs.mall.search.service.SearchServer;
import com.zgs.mall.search.vo.SearchParam;
import com.zgs.mall.search.vo.SearchResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class SearchController {
    @Autowired
    private SearchServer searchServer;
    @GetMapping("/list.html")
    public String listPage(SearchParam searchParam, Model model){
        SearchResult searchResult=  searchServer.search(searchParam);
        model.addAttribute("data",searchResult);
        return "list";
    }
}
